package com.ddone.finance.controller.admin;

import com.baomidou.mybatisplus.extension.api.R;
import com.ddone.common.result.Response;
import com.ddone.finance.pojo.entity.UserLoginRecord;
import com.ddone.finance.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ddone
 * @date 2024/4/18-16:48
 */
@Api(tags = "会员登录日志接口")
@RestController
@RequestMapping("/core/admin/userLoginRecord")
@Slf4j
// @CrossOrigin
public class AdminUserLoginRecordController {

    @Resource
    private UserLoginRecordService userLoginRecordService;

    @ApiOperation("获取会员登录日志列表")
    @GetMapping("/listLatest50/{userId}")
    public Response<Object> listLatest50(
            @ApiParam(value = "用户id", required = true)
            @PathVariable Long userId) {
        List<UserLoginRecord> userLoginRecordList = userLoginRecordService.listLatest50(userId);
        return Response.ok(userLoginRecordList);
    }
}
